package com.funong.matrix.biz.base.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.funong.matrix.core.base.FunongBaseEntity;
import com.funong.matrix.core.enums.IsDeletedEnum;
import com.funong.matrix.core.enums.StatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * sys_role_permission
 *
 * @author
 */
@Data
@Accessors(chain = true)
@ApiModel("权限实体")
@TableName("sys_permission")
public class SysPermissionEntity extends FunongBaseEntity {

    /**
     * 权限名称
     */
    @ApiModelProperty(value = "权限名称")
    private String name;

    /**
     * 权限编号
     */
    @ApiModelProperty(value = "权限编号")
    private String code;

    /**
     * 父权限编号
     */
    @ApiModelProperty(value = "父权限编号")
    private String parentCode;

    /**
     * 层级;(1: 一级层级 2 :二级层级 3:三级层级 )
     */
    @ApiModelProperty(value = "层级;(1: 一级层级 2 :二级层级 3:三级层级 )")
    private Integer level;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    private Integer orderNum;

    /**
     * 权限类型;（1新增2修改3查询）
     */
    @ApiModelProperty(value = "权限类型;（1新增2修改3查询）")
    private Integer permissionType;

    /**
     * 权限所属分组；（1通用功能，2业务功能）
     */
    @ApiModelProperty(value = "权限所属分组；（1通用功能，2业务功能）")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer groupType;

    /**
     * 系统类型;(1黄河 2昆仑)
     */
    @ApiModelProperty(value = "系统类型;(1黄河 2昆仑)")
    private Integer systemId;

    /**
     * 状态;（0停用, 1启用）
     */
    @ApiModelProperty(value = "状态;（0停用, 1启用）")
    private Integer status;

    @TableField(exist = false)
    private String createStartTime;

    @TableField(exist = false)
    private String createEndTime;

    @TableField(exist = false)
    private String queryStatus;

    @TableField(exist = false)
    private List<SysPermissionEntity> children;

    public static final LambdaQueryWrapper<SysPermissionEntity> gw() {
        return new LambdaQueryWrapper<SysPermissionEntity>().eq(FunongBaseEntity::getIsDeleted, IsDeletedEnum.NOT_DELETED.getValue()).eq(SysPermissionEntity::getStatus, StatusEnum.ENABLE.getValue());
    }

}